# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Mathieu Clabaut <mathieu.clabaut@gmail.com>
# Contributor: Artyom Smirnov <smirnoffjr@gmail.com>
# Contributor: Alexis Robert <alexis.robert@gmail.com>
# Maintainer: Daniel Nagy < danielnagy at gmx de>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - configure with --disable-abiflags
#  - patch to build with environment's CFLAGS

pkgname=libantlr3c
pkgver=3.4
pkgrel=1
pkgdesc="C runtime for the ANTLR parsing library"
url="http://www.antlr.org/"
arch=("i686" "x86_64")
license=("BSD")
depends=('bash')
makedepends=()
source=(http://www.antlr3.org/download/C/${pkgname}-${pkgver}.tar.gz
        antlr-c-3.3-cflags.patch)
md5sums=('08b1420129d5dccd0f4461cedf2a0d7d'
         'f936f142053c03ec57a0be95b7b8fe0c')

prepare() {
  cd "${pkgname}-${pkgver}"
  patch -p1 -i ../antlr-c-3.3-cflags.patch
  autoreconf -fi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  [ "$CARCH" = "x86_64" ] && _cfgopt=--enable-64bit
  [[ $CARCH =~ arm.* ]] && _cfgopt=--disable-abiflags
  ./configure --prefix=/usr --sysconfdir=/etc ${_cfgopt}
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make install DESTDIR="${pkgdir}"
  install -Dm0644 COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
}
